class MysqlTableListPlugin {
    constructor({api=false}) {
        this.api=api;
        this.tableName=this.api.dbBaseMapper.tableName;
    }

    install(app,args){
        app.set("views","./");
        //安装依赖的插件
        app.use(this.api);
        app.get(this.tableName+"/getTableSchema",async (req,res)=>{
            let tableSchema=await this.api.dbBaseMapper.getTableSchema();
            res.send(M.successResult(tableSchema))
        })
        app.use("/index.html",async (req,res)=>{
            res.render(args.pageUrl)
        })
    }

}

module.exports = MysqlTableListPlugin;

